import React from 'react';
import { Router, Route, Link  } from 'react-router'
import Header from './js/components/header'
import BlockBtn from './js/components/block-btn'
import DoctorStore from './js/doctorStore'
import {Actions} from './js/doctorStore/actions';

function getDepartments(){
    return DoctorStore.getDep()
}

export default class CallDoctor extends React.Component{
    constructor(props){
        super(props);
        this.state={
            departments: getDepartments()
        }
    }
    componentDidMount(){
        Actions.ctrlNav({show:true,active:1});
        DoctorStore.addChangeListener(this._onChange);
    }

    componentWillUnmount(){
        DoctorStore.removeChangeListener(this._onChange);
    }
    _onChange(){
        this.setState({
            departments: getDepartments()
        });
    }
    render(){
        return (
            <div>
                <Header title="问诊"></Header>
                <h2 className="result-info">按科室查找医生</h2>
                <BlockBtn height={86} cols={4} url="/doctors-list/" ico="departments" data={this.state.departments} />
            </div>
        )
    }
}